package top.lishuoboy.boot09profile.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import top.lishuoboy.boot09profile.service.Animal;
import top.lishuoboy.boot09profile.service.impl.Cat;
import top.lishuoboy.boot09profile.service.impl.Dog;
import top.lishuoboy.boot09profile.service.impl.Pig;

/**
 * @author lishuoboy
 * @date 2022/2/28 13:43
 */
@Configuration
public class MyConfig {

    @Profile("default")
    @Bean("animal")
    Animal cat() {
        return new Cat();
    }

    @Profile("test")
    @Bean("animal")
    Animal dog() {
        return new Dog();
    }

    @Profile("prod")
    @Bean("animal")
    Animal pig() {
        return new Pig();
    }
}